<template>
  <el-form ref="form1" :model="form" label-width="200px">
    <el-form-item label="暂停系统">
      <el-switch v-model="form.systemClosed"></el-switch>
    </el-form-item>
    <el-form-item label="禁用身份证区域">
      <el-input type="textarea" v-model="form.disableAreaCode" placeholder="请输入身份证前六位，使用','进行分割" ></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">保存</el-button>
      <el-button @click="getConfig">重新获取</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import { GetSysConfig, SaveSysConfig } from '@/api/sysConfig'

export default {
  data() {
    return {
      form: {
        systemClosed: false,
        disableAreaCode: ''
      }
    }
  },
  created() {
    this.getConfig()
  },
  methods: {
    onSubmit() {
      var _this = this
      SaveSysConfig(_this.form).then(result => {
        _this.$message.success('保存成功')
      })
    },
    getConfig() {
      var _this = this
      GetSysConfig().then(result => {
        _this.form = result.data
      })
    }
  }
}
</script>


